<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/info-detail.css"><!--资讯详情-->
    <link rel="stylesheet" href="../../css/pop-ups.css"><!--弹出层-->
    <link rel="stylesheet" href="../../css/icon-font.css"/><!--图标-->
    <link rel="stylesheet" href="../../css/share.css"/><!--分享-->
    <link rel="stylesheet" href="../../css/info-list.css"/><!--分享-->
    <link rel="stylesheet" href="../../css/comment.css"/>
    <title>资讯详情</title>
    <style>
        body {
            background-color: white;
        }

        .pd1720 {
            padding: 0.1rem 0.4rem 0.34rem 0.4rem
        }

        .info-detail-title {
            color: #222222;
        }

        .info-detail-character {
            margin: 0.24rem 0;
            color: rgba(34, 34, 34, 0.45);
        }

        .info-detail-mzsm {
            color: #A1A1A1;
            line-height: 0.36rem;
        }

        .info-detail-gp {
            text-align: center;
            height: 0.44rem;
            padding: 0 0.12rem;
            line-height: 0.44rem;
            background-color: #F7F7F7;
            margin-right: 0.16rem;
        }

        .info-detail-gp span {
            /*color: rgba(120,140,203,1);*/
            /*margin-right: .08rem;*/
        }

        .info-detail-gp-name {
            color: #222222;
            margin-right: 0.1rem;
        }

        .info-detail-gp-zs1 {
            color: #EC3E33;
        }

        .info-detail-gp-zs2 {
            color: #00AE1F;
        }

        .info-detail-label {
            color: #222222;
            text-align: center;
            height: 0.64rem;
            padding: 0 0.2rem;
            line-height: 0.64rem;
            background-color: #F7F7F7;
            margin-right: 0.16rem;
            border-radius: 0.04rem;
        }

        .info-detail-line + div {
            color: #222222;
            margin: 0 0.2rem;
        }

        .info-detail-divide {
            width: 7.5rem;
            background-color: #F7F7F7;
            height: 0.16rem;
            margin: 0.72rem 0 0.4rem 0;
        }

        .info-detail-list {
            max-height: 15rem;
        }

        .p4 {
            padding: 0 0.4rem;
        }

        .p4:first-child {
            color: #222222;
            margin-bottom: 0.04rem;
        }

        .info-detail-split {
            width: 7.5rem;
            height: 0.01rem;
            background: rgba(0, 0, 0, 0.15);
        }

        .info-detail-play {
            height: 0.32rem;
            width: 0.32rem;
        }

        .info-detail-yp {
            top: 0.1rem;
            left: 0.16rem;
        }


        .download-box {
            width: 100%;
            height: 58px;
            background: rgba(255, 255, 255, 0.95);
            box-shadow: 0 -2px 4px 0 rgba(0, 0, 0, 0.1);
            padding: 0 16px;
        }

        .download-box img {
            width: 32px;
            height: 32px;
            background: #2A66FF;
            border-radius: 9px;
        }

        .download-item {
            margin-left: .18rem;
        }

        .download-app-title {
            line-height: 20px;
            color: #434346;
        }

        .download-app-desc {
            color: rgba(0, 0, 0, 0.5);
            line-height: 12px;
        }

        .download-app-open {
            height: 28px;
            background: #FF9523;
            border-radius: 14px;
            color: #FFFFFF;
            padding: 0 .12rem;
        }

        .download-app {
            height: 28px;
            background: #4E7EF4;
            border-radius: 14px;
            color: #FFFFFF;
            padding: 0 .2rem;
            margin-left: .24rem;
        }


    </style>
</head>
<body>

<div class="info-detail-wrap flex-column ff400 h-100-p">
    <!--状态栏-->
    <div class="placeholder-top">
        <!--状态栏-->
        <div class="bg-main status-bar"></div>
        <!--导航栏-->
        <div class="bg-main nav-bar flex-row justify-content-between c-white align-items-center">
            <div class="left-bar" onclick="infoBack()">
                <span class="iconfont iconfanhui1 fs16"></span>
            </div>
            <div class="center-bar fs16 ff500 flex-1 line1"></div>
            <div class="flex-row">
                <div class="info-detail-voice flex-row justify-content-center align-items-center right-bar-mult"
                     style="display: none" onclick="voicePlay()">
                    <span class="info-detail-bf pos-r iconfont iconyinpin fs16">
                       <svg class="info-detail-yp pos-a icon fs18" aria-hidden="true">
                            <use xlink:href="#iconyinpin1"/>
                        </svg>
                    </span>
                    <img class="info-detail-play" style="display:none;" src="../../images/home/play.gif"/>
                </div>
                <div class="right-bar-mult" style="text-align: center; line-height: 1.05rem" onclick="report()">
                    <img style="height:0.4rem;width:0.4rem;" src="../../images/jubao.jpg"/>
                </div>
                <div class="flex-row justify-content-center right-bar-mult" onclick="judgeOrCollect()">
                    <span class="info-detail-sc iconfont iconshoucang1 fs17"></span>
                    <span class="info-detail-sc iconfont iconshoucang fs17" style="color:#2C68F5;display:none"></span>
                </div>
                <div class="flex-row justify-content-center right-bar-mult" onclick="dealShare()">
                    <span class="iconfont iconfenxiang1 fs16"></span>
                </div>
            </div>
        </div>
    </div>

    <div class="flex-1 scoll-y scoll-area">
        <div class="pd1720">
            <div class="info-detail-title ff600 fspx22"></div>
            <div class="info-detail-character fspx13 ff400"><span></span> · <span></span></div>
            <!--资讯详情部分-->
            <div class="info-detail">

            </div>
            <div class="info-detail-mzsm mt5 fspx12 mb10">
                免责声明：文章内容仅供参考，不构成投资建议。投资者据此操作，风险自担。文章部分内容来自网络，如有涉及侵权烦请联系JT²智管有方资讯部责任编辑，邮箱newsfeedback@jd.com，我们将第一时间处理。如无特别注释，图片均来自视觉中国。
            </div>
            <!--股票债券信息-->
            <div class="flex-row flex-wrap info-detail-words"></div>

            <!--关键字-->
            <div class="info-detail-labels flex-row mt10 flex-wrap"></div>
            <div class="info-detail-share flex-column">

            </div>
        </div>
        <div class="info-detail-divide"></div>
        <div class="info-detail-list-wrap p4">
            <div class="fspx18 ff600">延伸阅读</div>
        </div>
        <div class="info-detail-list"></div>

        <!--<div class="info-detail-split mt20"></div>-->
    </div>

    <div class="comment-area dis-n">
    </div>

    <!--<div class="download-box flex-row justify-content-between align-items-center">-->
    <!--    <div class="flex-row">-->
    <!--        <img src="">-->
    <!--        <div class="flex-column download-item">-->
    <!--            <div class="download-app-title ff500 fs16">智管有方</div>-->
    <!--            <div class="download-app-desc ff400 fs11">一站式资管科技平台</div>-->
    <!--        </div>-->
    <!--    </div>-->
    <!--    <div class="flex-row">-->
    <!--        <div class="flex-row align-items-center download-app-open fs12">APP内打开</div>-->
    <!--        <div class="flex-row align-items-center download-app fs12">下载APP</div>-->
    <!--        <span class="info-detail-sc iconfont iconshoucang1 fs17"></span>-->
    <!--    </div>-->

    <!--</div>-->

</div>


</body>
<!--这四个文件的引入必须按照顺序-->
<script src="../../js/dict.js"></script>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/checkJsBridge.js"></script>
<script src="../../js/utils.js"></script>
<script src="../../js/api.js"></script>
<!--这四个文件的引入必须按照顺序-->
<script src="../../js/date.js"></script>
<script src="../../js/icon-font.js"></script><!--用于彩色字体图标-->
<script src="../../js/template.js"></script>
<script src="../../js/protobuf.min.js"></script>
<script src="../../js/proto.js"></script>
<script>
  let pm = {
    infoId: '',
    infoType: '',
    trialContent: '',
    title: '',
    coverImgUrl: '',
    pageNum: 1,
    pageSize: 10,
    isScroll: false,
    isCollect: 0,
    isThumb: 0,
    commentCnt: 0,
    thumbsupCnt: 0,
    datasource: '2',
    stockList: [],
    data: {},
    voiceUrl: '',
    isLogin: false
  }
  let keywordsMap = {}, isWeb = platform === 'web'

  function initPage(params) {
    //状态栏自适应
    Utils.sbhAdaptive()
    pm.infoId = params.infoId
    pm.infoType = params.infoType

    pm.isLogin = !user.isGuest

    //获取明细
    getDetail()  // 查询资讯明细
    getExtended()// 获取延伸阅读
    findCollectStatus() // 查询收藏状态
    getCommentInfo() // 获取评论点赞信息
    pageScroll()
    judgeCurrentVoice(params.infoId)
    if (isWeb) {
      $('.comment-area').hide()
      $('.download-box').show()
    } else {
      $('.download-box').hide()
      $('.comment-area').show()
    }

    //阅读数据缓存
    dataCache(pm.infoId)
  }

  function reLoadPage() {
    pm.isLogin = !user.isGuest

    getDetail()  // 查询资讯明细
    getExtended()// 获取延伸阅读
    findCollectStatus() // 查询收藏状态
    getCommentInfo() // 获取评论点赞信息
  }

  function startPage(params) {
    pm.isLogin = !user.isGuest
    getCommentInfo()
  }


  function getDetail() {
    Server.infoDetail.getInfoDetail({//获取资讯明细
      infoId: pm.infoId,
      infoType: pm.infoType,
      channel: 'JT2_APP'
    }).then(function success(data) {
      pm.title = data.mainTitle
      pm.trialContent = data.trialContent
      pm.coverImgUrl = data.coverImgUrl
      if (data.voiceUrl) {
        pm.voiceUrl = data.voiceUrl
        $('.info-detail-voice').show()
      }
      $('.info-detail-character').find('span').eq(0).text(data.characterName)
      $('.info-detail-character').find('span').eq(1).text(DateUtils.int2TimeDesc(data.issuerDttm))
      $('.info-detail-title').html(data.mainTitle)
      //   $('.info-detail').html(data.newContent || data.content)
      $('.info-detail').html(deatContentText(data))
      if (data.infoLabel) {
        data.infoLabel = (data.infoLabel.endsWith(',') || data.infoLabel.endsWith('，')) ? data.infoLabel.substring(0, data.infoLabel.length - 1) : data.infoLabel
        data.infoLabel = data.infoLabel.replace(/，/g, ',')
        let infoLabels = data.infoLabel.split(/[,，]/)
        infoLabels.forEach(function (item) {
          if (item) {
            $('.info-detail-labels').append(' <div class=\'info-detail-label fspx13 mt10\' onclick="jumpLabel(\'' + item + '\')">' + item + '</div>')
          }
        })
      }

      let htmlStr = dealWord(data)
      $('.info-detail-words').html(htmlStr)

      $('.info-detail-share').html(Template.share())

      stockRise()
    }).catch(jsBridge.log)
  }


  // 关键词样式替换和跳转地址添加
  function deatContentText(data) {
    // 把不同的svg原码赋值给不同的变量
    let typeSvgOne = '<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\
        <desc>Created with Sketch.</desc>\
        <defs>\
            <path d="M7.115625,0 C7.62821428,0 8.04375,0.427408166 8.04375,0.954642857 C8.04375,1.48187755 7.62821428,1.90928571 7.115625,1.90928571 C7.04093342,1.90928571 6.96830254,1.9002107 6.89871772,1.88307419 L6.37325634,2.86255715 C7.00339111,3.25204329 7.425,3.96198603 7.425,4.77321429 C7.425,5.35871223 7.20537875,5.8914493 6.8462479,6.28902494 L7.63571059,6.92644402 C7.85801596,6.58731835 8.23493545,6.36428571 8.6625,6.36428571 C9.34595238,6.36428571 9.9,6.93416327 9.9,7.63714286 C9.9,8.34012245 9.34595238,8.91 8.6625,8.91 C7.97904762,8.91 7.425,8.34012245 7.425,7.63714286 C7.425,7.62767967 7.4251004,7.6182406 7.42530017,7.60882672 L6.31934362,6.7161165 C6.00602481,6.89734628 5.64443603,7.00071429 5.259375,7.00071429 C4.708541,7.00071429 4.20573971,6.78918599 3.82356255,6.44079485 L3.07557588,7.07427549 C3.08754179,7.15402617 3.09375,7.23573165 3.09375,7.31892857 C3.09375,8.19765306 2.40119047,8.91 1.546875,8.91 C0.692559528,8.91 0,8.19765306 0,7.31892857 C0,6.44020409 0.692559528,5.72785714 1.546875,5.72785714 C2.07811601,5.72785714 2.54680995,6.00330424 2.82532654,6.42292155 L3.40796474,5.92942118 C3.2085848,5.59237636 3.09375,5.19658903 3.09375,4.77321429 C3.09375,3.54300001 4.06333334,2.54571429 5.259375,2.54571429 C5.44427033,2.54571429 5.62375379,2.56954729 5.79508,2.6143895 L6.37590173,1.53130353 C6.25766688,1.37109343 6.1875,1.17129644 6.1875,0.954642857 C6.1875,0.427408166 6.60303572,0 7.115625,0 Z M2.165625,1.27285714 C2.70477633,1.27285714 3.17950405,1.55656828 3.45639119,1.98676168 C2.53385875,2.24269754 1.85625,3.10834871 1.85625,4.13678571 C1.85625,4.23518914 1.8624536,4.33210224 1.87448049,4.42713383 C1.15929214,4.28670453 0.61875,3.64024532 0.61875,2.86392857 C0.61875,1.98520409 1.31130953,1.27285714 2.165625,1.27285714 Z" id="path-1"></path>\
        </defs>\
        <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\
            <g id="切图" transform="translate(-935.000000, -1674.000000)">\
                <g id="编组-13" transform="translate(939.000000, 1678.000000)">\
                    <g id="编组-7备份" transform="translate(0.500000, 0.500000)">\
                        <mask id="mask-2" fill="white">\
                            <use xlink:href="#path-1"></use>\
                        </mask>\
                        <use id="path备份-12" fill="#1890FF" xlink:href="#path-1"></use>\
                    </g>\
                </g>\
            </g>\
        </g>\
    </svg>'
    let typeSvgTwo = '<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\
        <desc>Created with Sketch.</desc>\
        <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\
            <g id="切图" transform="translate(-911.000000, -1674.000000)" fill="#1890FF">\
                <g id="编组-4备份" transform="translate(915.000000, 1678.000000)">\
                    <path d="M8.5,0 C9.32842712,-1.52179594e-16 10,0.671572875 10,1.5 L10,8.5 C10,9.32842712 9.32842712,10 8.5,10 L1.5,10 C0.671572875,10 1.01453063e-16,9.32842712 0,8.5 L0,1.5 C-1.01453063e-16,0.671572875 0.671572875,1.52179594e-16 1.5,0 L8.5,0 Z M8.375,0.625 L1.625,0.625 C1.07271525,0.625 0.625,1.07271525 0.625,1.625 L0.625,1.625 L0.625,8.375 C0.625,8.92728475 1.07271525,9.375 1.625,9.375 L1.625,9.375 L8.375,9.375 C8.92728475,9.375 9.375,8.92728475 9.375,8.375 L9.375,8.375 L9.375,1.625 C9.375,1.07271525 8.92728475,0.625 8.375,0.625 L8.375,0.625 Z" id="path"></path>\
                    <path d="M8.125,6.25 L8.125,7.5 L1.875,7.5 L1.875,6.25 L8.125,6.25 Z M8.125,2.5 L8.125,3.75 L1.875,3.75 L1.875,2.5 L8.125,2.5 Z" id="path2"></path>\
                </g>\
            </g>\
        </g>\
    </svg>'
    // 获取原始content
    let content = data.content
    let list = []
    let infoId = data.infoId
    if (data.keyWords) {
      list = JSON.parse(data.keyWords)
    }
    if (list && list.length > 0) {
      // 处理后端返回过来的type-url字符串转换为对象格式
      list.forEach(function (item, index) {
        let temList = []
        let temObj = {}
        // 去掉type-url末尾的分号
        let typeUrlLength = item['type-url'].length
        if (item['type-url'][typeUrlLength - 1] === ';') {
          item['type-url'] = item['type-url'].substring(0, typeUrlLength - 1)
        }

        temList = item['type-url'].split(';')
        temList.forEach(function (item, index) {
          let temItemList = item.split(':')
          temObj[temItemList[0]] = temItemList[1]
        })
        item['type-url'] = temObj
      })
      content = content.replace(/<a[^>]*?>.*?<\s*\/a\s*>/gi, function (result) {
        return generateKey(result)
      })
      // 循环遍历list
      list.forEach(function (item, index) {
        // 判断关键词类型中是否有数据和产业链的类型
        if (item['type-url']['5'] || item['type-url']['1']) {
          if (!item['type-url']['1'] && item['type-url']['5']) {
            let jsonStr = JSON.stringify({ // 5 数据图表
              type: 5,
              word: item.key,
            })
            content = content.replace(getPattern(item.key), function () {
              return generateKey('<a  href="javascript:void(0)" onclick=\'goWordDetail(' + jsonStr + ')\'>' + item.key + '</a>')
            })
          } else if (!item['type-url']['5'] && item['type-url']['1']) { // 1 产业链详情
            let jsonStr = JSON.stringify({ // 1 产业链详情
              type: 1,
              word: item.key,
            })
            // 只有类型2
            content = content.replace(getPattern(item.key), function () {
              return generateKey('<a  href="javascript:void(0)" onclick=\'goWordDetail(' + jsonStr + ')\'>' + item.key + '</a>')
            })
          } else if (item['type-url']['5'] && item['type-url']['1']) {
            let jsonStr1 = JSON.stringify({ // 1 产业链详情
              type: 1,
              word: item.key,
            })
            let jsonStr2 = JSON.stringify({ // 5 数据图表
              type: 5,
              word: item.key,
            })
            // 有类型1和2
            content = content.replace(getPattern(item.key), function () {
              return generateKey('<a class="svgText" href="javascript:void(0)">' + item.key + '</a><span class="svgLR">(</span><a href="javascript:void(0)" class="svgone svg-display" onclick=\'goWordDetail(' + jsonStr2 + ')\'>' + typeSvgTwo + '</a>\
                    <a href="javascript:void(0)" class="svgone svg-display" onclick=\'goWordDetail(' + jsonStr1 + ')\'>' + typeSvgOne + '</a><span class="svgLR">)</span>')
            })
          }
          // 关键词类型没有数据和产业链类型的
        } else {
          // 循环遍历
          // 债券、股票、公司实体
          if (item['type-url']['3']) {
            let jsonStr = JSON.stringify({ // 3 债券
              type: 3,
              word: item.key,
            })
            content = content.replace(getPattern(item.key), function () {
              return generateKey('<span style="color: #1890FF; cursor: pointer; text-decoration: underline;" onclick=\'goWordDetail(' + jsonStr + ')\'>' + item.key + '</span>')
            })
          } else if (item['type-url']['2']) {
            let lastPointIndex = item['type-url']['2'].lastIndexOf('.')
            let firstPointIndex = item['type-url']['2'].indexOf('.')
            let exchange = item['type-url']['2'].substring(0, firstPointIndex)
            let code = item['type-url']['2'].substring(firstPointIndex + 1, lastPointIndex - 2)
            let jsonStr = JSON.stringify({
              type: 2,
              word: item.key,
              exchange: exchange,
              stockCode: code
            })
            content = content.replace(getPattern(item.key), function () {
              return generateKey('<span class="stock-info" onclick=\'goWordDetail(' + jsonStr + ')\'><span>' + item.key + '</span><span class="stock-code">' + item['type-url']['2'].substring(0, lastPointIndex - 2) + '</span></span>')
            })
          } else if (item['type-url']['6']) {
            let lastPointIndex = item['type-url']['6'].lastIndexOf('.')
            let firstPointIndex = item['type-url']['6'].indexOf('.')
            let code = item['type-url']['6'].substring(0, firstPointIndex)
            let exchange = item['type-url']['6'].substring(firstPointIndex + 1, lastPointIndex - 2)
            let jsonStr = JSON.stringify({
              type: 6,
              word: item.key,
              exchange: exchange,
              stockCode: code
            })
            content = content.replace(getPattern(item.key), function () {
              return generateKey('<span class="stock-info" onclick=\'goWordDetail(' + jsonStr + ')\'><span>' + item.key + '</span><span class="stock-code">' + item['type-url']['6'].substring(0, lastPointIndex - 2) + '</span></span>')
            })
          } else if (item['type-url']['4']) {
            let jsonStr = JSON.stringify({
              type: 4,
              word: item.key,
            })
            content = content.replace(getPattern(item.key), function () {
              // return generateKey('<span style="color:#1890FF;cursor: pointer;text-decoration:underline" onclick=\'goWordDetail(' + jsonStr + ')\'>' + item.key + '</span>')
              return generateKey('<span></span>')
            })
          }
        }
      })
      let reg_keys = Object.keys(keywordsMap).join('|')
      content = content.replace(new RegExp('(' + reg_keys + ')', 'g'), function (result) {
        return keywordsMap[result] ? keywordsMap[result] : ''
      })
    }
    // 文章内容渲染到页面
    $('.info-detail').html(content)
  }

  function generateKey(text) {
    let chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
      , 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
      , '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    let res = '---'
    for (let i = 0; i < 16; i++) {
      if (i % 2 === 0) {
        let id = Math.ceil(Math.random() * 62)
        res += chars[id]
      } else {
        res += '-'
      }
    }
    keywordsMap[res] = text
    return res
  }


  // 根据不同的keywords类型获取对应的正则表达式
  function getPattern(targetStr) {
    let str = targetStr.replace(/\*/g, '\\*')
    return new RegExp('(?![^<]*?>)(?:' + str + ')')
  }


  function dealWord(item) {

    //  获取原始的keyWords
    let list = []
    let infoId = item.infoId
    if (item.keyWords) {
      list = JSON.parse(item.keyWords)
    }
    // 处理后端返回过来的type-url字符串转换为对象格式
    list.forEach(function (item, index) {
      let temList = []
      let temObj = {}
      // 去掉type-url末尾的分号
      let typeUrlLength = item['type-url'].length
      if (item['type-url'][typeUrlLength - 1] === ';') {
        item['type-url'] = item['type-url'].substring(0, typeUrlLength - 1)
      }

      temList = item['type-url'].split(';')
      temList.forEach(function (item, index) {
        let temItemList = item.split(':')
        temObj[temItemList[0]] = temItemList[1]
      })
      item['type-url'] = temObj
    })

    //  再次循环遍历list按产业链、数据、股票、债券、公司实体的先后顺序去排列；
    let tempArr = []
    //  分别设置布尔变量，来控制每种类型只显示一次；
    //  is1First中的“1”是后端的类型编号，obj.index = 1 中的“1”是类型的先后排序号的标记；
    let is1First = true, is2First = true, is3First = true, is4First = true, is5First = true
    let obj = {}
    list.forEach(function (item, index) {

      if (item['type-url']['2'] || item['type-url']['6']) {
        obj = JSON.parse(JSON.stringify(item))
        obj.index = 3
        tempArr.push(JSON.parse(JSON.stringify(obj)))
        pm.stockList.push(obj)
        is2First = false
      }

    })

    let htmlStr = ''
    if (tempArr && tempArr.length > 0) {
      // 循环遍历tempArr,生成对应的标签字符串
      tempArr.forEach(function (obj, index) {
        let arr = (obj['type-url']['2'] || obj['type-url']['6']).split('.')
        let exchange = arr[0] ? arr[0].replace('*', '') : arr[0]
        let stockCode = arr[1]
        if (obj['type-url']['6']) {
          let tempExchange = exchange
          exchange = stockCode
          stockCode = tempExchange
        }
        let jsonStr = JSON.stringify({
          type: 6,
          word: obj.key,
          exchange: exchange,
          stockCode: stockCode
        })
        htmlStr += '    <div class="flex-row info-detail-gp fspx13 mt10 ff500" onclick=\'goWordDetail(' + jsonStr + ')\'>'
        htmlStr += '        <div class="info-detail-gp-name ff500">' + obj.key + '</div>\n'
        htmlStr += '        <span class="info-detail-gp-zs1 _' + (obj['type-url']['2'] ? arr[1] : arr[0]) + ' "></span>'
        htmlStr += '    </div>\n'
      })
    }
    return htmlStr
  }

  // 延伸阅读
  function getExtended() {
    Server.infoDetail.getInfoListSearch({//
      infoId: pm.infoId, //'dfd5d5fd147e496d8fdb294f19620463',
      pageNum: pm.pageNum,
      pageSize: pm.pageSize
    }).then(function success(data) {
      let num = 0
      let htmlStr = ''
      $.each(data.infoListSearch, function (i, item) {
        if (item.infoType === '1' || item.infoType === '3') {
          num++
          if (num <= 5) {
            htmlStr += Template.dealInfo(item)
            htmlStr += '<div class="info-list-topborder"></div>'

          }
        }
      })
      if (num > 0) {
        $('.info-detail-list').html(htmlStr)
        $('.info-detail-list .info-list-topborder').last().remove()
        Template.stockRise()
      } else {
        $('.info-detail-list-wrap').hide()
        $('.info-detail-divide').hide()
      }
    })
  }


  //收藏状态
  function findCollectStatus() {
    // 如果现在是web端，那就不请求收藏状态了
    !isWeb &&
    Server.infoDetail.findCollectStatus({
      collectionObjectId: pm.infoId,
      objectSource: pm.infoType,
    }).then(function (data) {
      //如果data._code大于0則說明已收藏
      if (data.isCollect > 0) {
        pm.isCollect = 1
        $('.info-detail-sc').toggle()
      }
    })
  }

  //点击收藏
  function judgeOrCollect() { //修改收藏的状态
    if (pm.isLogin) {
      $('.info-detail-sc').toggle()
      pm.isCollect = pm.isCollect === 1 ? 0 : 1
      Server.infoDetail.addOrModifyCollectionInfo({
        collectionObjectId: pm.infoId,
        objectSource: pm.infoType,
        datasource: pm.datasource,
        status: pm.isCollect,
      }).then(function (data) {
        // 弹出收藏、取消收藏成功
        if (data.code === 0) {
          jsBridge.callBridge('toast', {msg: (pm.isCollect === 1 ? '收藏成功' : '取消收藏成功')})
        }
      })
    } else {
      Utils.goLogin()
    }
  }


  //查看点赞状态
  function queryThumbStauts() {
    // 如果现在是web端，也不需要查询评论点赞状态
    !isWeb &&
    Server.infoDetail.queryThumbStauts({
      thumbupObjectId: pm.infoId,
      status: 1,
    }).then(function (data) {
      if (data.isThumb > 0) {
        pm.isThumb = 1
        $('.info-detail-wrap .comment-thumbsup-icon').addClass('comment-thumbsup-c')
      }
    })
  }

  // 点赞文章
  function goThumb() {
    if (pm.isLogin) {
      if (pm.isThumb === 1) { // 如果是取消点赞
        pm.isThumb = 0
        $('.info-detail-wrap .comment-thumbsup-icon').removeClass('comment-thumbsup-c')
        pm.thumbsupCnt = pm.thumbsupCnt === 1 ? '' : (pm.thumbsupCnt - 1)
        $('.info-detail-wrap .comment-thumbsup-cnt').text(pm.thumbsupCnt)
      } else {// 如果是点赞
        pm.isThumb = 1
        $('.info-detail-wrap .comment-thumbsup-icon').addClass('comment-thumbsup-c')
        pm.thumbsupCnt = pm.thumbsupCnt ? (pm.thumbsupCnt + 1) : 1
        $('.info-detail-wrap .comment-thumbsup-cnt').text(pm.thumbsupCnt)
      }
      Server.infoDetail.updateThumbsupInfo({
        thumbupObjectId: pm.infoId,
        objectSource: pm.infoType,
        datasource: pm.datasource, // 1、ios 2、安卓
        status: pm.isThumb
      }).then(function (data) {
        if (data.code === 0) {
          jsBridge.callBridge('toast', {msg: (pm.isThumb === 1 ? '点赞成功' : '取消点赞成功')})
        }
      })
    } else {
      Utils.goLogin()
    }
  }

  function showInput(v) {
    if (v === 0) {//取消发布
      $('.comment-show').hide()
    } else if (v === 1) { //发布评论
      if (Utils.emojiJudge($('.info-detail-wrap .comment-content').val())){
        // 不允许输入表情
        jsBridge.callBridge('toast', {msg: '请勿输入表情'})
        return
      }else if ($('.info-detail-wrap .comment-content').val() && $('.info-detail-wrap .comment-content').val().trim()) {//如果有内容，则添加评论
        addCommentInfo()
        showInput(0)
      } else {//弹出内容不能为空
        jsBridge.callBridge('toast', {msg: '评论不能为空'})
      }
    }
  }

  // 添加评论
  function addCommentInfo() {
    Server.infoDetail.addCommentInfo({
      commentObjectId: pm.infoId,
      objectSource: pm.infoType,
      datasource: pm.datasource,
      content: $('.info-detail-wrap .comment-content').val(),
    }).then(function (data) {
      if (data.code === 0) {
        jsBridge.callBridge('toast', {msg: '评论成功'})
        $('.info-detail-wrap .comment-content').val('')
        // 跳转到评论列表
        goComment()
      }
    })
  }

  // 加载评论列表
  function goComment() {
    goCommentList({infoId: pm.infoId, infoType: pm.infoType})
  }

  function writeComment() {
    if (!isWeb) {
      // 只有APP端，才允许唤起分享
      if (pm.isLogin) {
        $('.comment-show').show()
        $('.comment-content').focus()
      } else {
        Utils.goLogin()
      }
    }
  }

  //页面内分享
  function shareClick(scene) {
    let item = {
      title: pm.title,
      content: pm.trialContent,
      url: `${systemConfig.server.gateWay}/gateway/api/jtzx/v2/html/info/info-detail.html?infoId=${pm.infoId}&infoType=${pm.infoType}&version=${systemConfig.version}`,
      image: pm.coverImgUrl,
      type: 'url',
      scene: scene
    }

    Utils.goShare(item)
  }

  //弹窗分享
  function dealShare() {
    let item = {
      title: pm.title,
      content: pm.trialContent,
      url: `${systemConfig.server.gateWay}/gateway/api/jtzx/v2/html/info/info-detail.html?infoId=${pm.infoId}&infoType=${pm.infoType}&version=${systemConfig.version}`,
      image: pm.coverImgUrl,
      type: 'url'
    }
    Template.shareWindow(item)
  }

  // label 跳转
  function jumpLabel(key) {
    //jsBridge.callBridge('toast', {msg: '标签跳转' + val})
    key = key ? encodeURIComponent(Utils.replaceAll(key, '%', '%25')) : ''
    jsBridge.openWindow('html/search/search.html?key=' + key, {}, {noBar: false})
    jsBridge.callBridge('closeInfoVoice')
  }

  //行业跳转
  function openIndustry(url) {
    if (!url) {
      return
    }
    window.open('//jt2.jd.com/industryChain/detail/' + url)
    return false
  }

  // 债券跳转
  function openBond(bondCode) {
    if (!bondCode) {
      return
    }
    bondCode = bondCode.trim()
    window.open('//jt2.jd.com/mall/securities/' + bondCode)
    return false
  }


  function goto(v, type) {
    if (type === '-1') {
      // 外部链接
      jsBridge.openWindow(v, {}, {noBar: true})
    } else {
      // 跳转到资讯详情页
      goDetail({infoId: v, infoType: type})
    }
    // 关闭资讯语音
    jsBridge.callBridge('closeInfoVoice')
  }

  // 获取评论数点赞数
  function getCommentInfo() {
    !isWeb &&
    Server.infoDetail.getCommentInfo({//获取资讯明细
      infoId: pm.infoId
    }).then(function (data) {
      pm.commentCnt = data.commentCount
      pm.thumbsupCnt = data.thumbCount
      $('.comment-area').html(Template.commentDetail(pm.commentCnt, pm.thumbsupCnt))
      queryThumbStauts() // 查看点赞状态
    })
  }


  //处理状态栏滚动效果
  function dealHead(scrollTop) {
    let currStop
    if (scrollTop < 64) {
      currStop = scrollTop
      $('.center-bar').html('')
      $('.left-bar').css({
        'color': 'rgb(34,34,34)'
      })
    } else {
      currStop = 64
      $('.center-bar').html(pm.title)
      $('.left-bar').css({
        'color': 'rgba(34, 34, 34, ' + currStop / 64 + ')'
      })
    }
    $('.placeholder-top').css({
      'background': 'rgba(255, 255, 255, ' + currStop / 64 + ')'
    })

  }

  /**
   * @param callback 翻页回调函数
   */
  function pageScroll() {
    $('.scoll-area').scroll(function () {
      //需要特殊处理的滚动区域，需要放在scroller元素区域内
      let scrollTop = $(this).scrollTop()
      dealHead(scrollTop)
    })
  }


  //股票涨跌幅
  function stockRise() {
    if (pm.stockList.length > 0) {
      let listContract = {
        listContract: [
          {}
        ]
      }
      listContract.listContract = []
      pm.stockList.forEach(function (item) {
        let it = (item['type-url']['2'] || item['type-url']['6']).split('.')
        let obj = {}
        obj.exchangeNo = item['type-url']['2'] ? it[0] : it[1]
        obj.commodityNo = item['type-url']['2'] ? it[1] : it[0]
        obj.commodityType = it[2]
        obj.contractNo = '9999'
        listContract.listContract.push(obj)
      })
      const buf = protoBuf.encodeToBase64('GetSnapshotRequest', listContract)
      Server.infoDetail.getSnapshot({
        request: buf
      }).then(function (data) {
        let result = protoBuf.decodeFromBase64('GetSnapshotResponse', data.data)
        result.listSnapshot.forEach(function (item) {
          if (item.changeRate) {
            if (item.changeRate > 0) {
              $('._' + item.commodityNo).html('<span style="color:#EC3E33">+' + (item.changeRate * 100).toFixed(2) + '%</span>')
            } else {
              $('._' + item.commodityNo).html('<span style="color:#00AE1F">' + (item.changeRate * 100).toFixed(2) + '%</span>')
            }
          } else {
            $('._' + item.commodityNo).html('')
          }
        })

      })
    }

  }

  //语音播放
  function voicePlay() {
    if ($('.info-detail-play').css('display') === 'none') { // 如果不是播放中
      $('.info-detail-bf').hide()
      $('.info-detail-play').show()
      jsBridge.openInfoVoice({
        voiceUrl: pm.voiceUrl,
        mainTitle: pm.title,
        infoType: pm.infoType,
        infoId: pm.infoId,
        coverImgUrl: pm.coverImgUrl
      })
    } else { // 如果处于播放中
      $('.info-detail-bf').show()
      $('.info-detail-play').hide()
      jsBridge.callBridge('closeInfoVoice')
    }

  }

  //获取当前播放的音频并判断是否要使音频的播放状态置为动态
  function judgeCurrentVoice(infoId) {
    jsBridge.callBridge('getCurrentVoice').then(item => {
      jsBridge.log(item)
      if (item === infoId){
        $('.info-detail-bf').hide()
        $('.info-detail-play').show()
      }
    })

  }
  // 资讯返回
  function infoBack() {
    // 关闭资讯语音
    //jsBridge.callBridge('closeInfoVoice')
    clickBack()
  }

  // 原生调用关闭声音的方法
  function voiceClose() {
    $('.info-detail-bf').show()
    $('.info-detail-play').hide()
  }


  //阅读数据缓存
  function dataCache(id) {
    localStorage.setItem('infoReadData_' + id, '1')
  }


</script>
</html>
